{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style type="text/css">
    #des,#des input{ width: 40px;text-align:center;}
    #id{ width: 78px; }
    .bs-checkbox{ width: 36px; height: 40px }
    .fixed-table-toolbar .columns,.fixed-table-toolbar .search{margin-left:0px; margin-top: 0px }
    #title span{ float: right; }
    .asdlkjasd{ background: #1ab394; color: #fff}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
            {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar" style="display:inline-block; margin-right:100px">
                        <a class="btn btn-default btn-outline {present name='types'}{else /}asdlkjasd{/present}"
                           href="{:url('chat')}">全部</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='1'}asdlkjasd{/eq}"
                           href="{:url('chat',['types'=>'1'])}">消息</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='2'}asdlkjasd{/eq}"
                           href="{:url('chat',['types'=>'2'])}">语音</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='3'}asdlkjasd{/eq}"
                           href="{:url('chat',['types'=>'3'])}">视频</a>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                            <table data-toggle="table">
                                <thead>
                                <tr>
                                    <th class="bs-checkbox"><input type="checkbox" id="delidAll"></th>
                                    <th data-align="center">id</th>
                                    <th data-align="center">分类</th>
                                    <th data-align="center">价格</th>
                                    <th data-align="center">魅力值等级下限</th>
                                    <th data-align="center">管理</th>
                                </tr>
                                </thead>
                                <tbody id="form">
                                {volist name="data" id="v"}
                                <tr id="id{$v.id}" class="class">
                                    <td id="delid" ><input name="delAll[]" type="checkbox" value="{$v.id}"></td>
                                    <td>{$v.id}</td>
                                    <td>
                                        {switch name="v.types"}
                                            {case value="1"}<span class="btn btn-default btn-xs">消息</span>{/case}
                                            {case value="2"}<span class="btn btn-primary btn-xs" style="background-color:#D8BFD8;border-color:#D8BFD8">语音</span>{/case}
                                            {default /}<span class="btn btn-primary btn-xs" style="background-color:#ADD8E6;border-color:#ADD8E6">视频</span>
                                        {/switch}
                                    </td>
                                    <td>{$v.price}</td>
                                    <td>{$v.min_charm_grade}</td>
                                    <td>
                                        <div class="btn-group">
                                            <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">操作 <span class="caret"></span>
                                            </div>
                                            <ul class="dropdown-menu">
                                                <li><a onClick="add('{:url('addChat',['id'=>$v['id'], 'url' => -1])}')">修改</a>
                                                </li>
                                                <li class="divider"></li>
                                                <li><a onClick="del({$v.id})">删除</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-12 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}

<script type="text/javascript">

    $(document).ready(function(){
        $('#delidAll').click(function(){
            $('input[type=checkbox]').each(function(){
                var self=$(this);
                if(!self.prop('checked')){
                    self.prop('checked',true);
                }else{
                    self.prop('checked',false);
                }
            });
        })
    });

    function del(id){
        swal_del(id,"{:url('delChat')}")
    }

</script>
